Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(molecule): support the latest mol grammar #738

Merged
merged 8 commits into from
Aug 6, 2024

Conversation

homura
Copy link
Collaborator

@homura homura commented Aug 6, 2024

Description

The previous version of @ckb-lumos/molecule does not fully support all molecule syntax, such as comment starting with #, comments in table or struct declaration blocks, import syntax, syntax version, newline breaker \r\n in Windows, and more. This PR refactors the parser to support the latest Molecule syntax.

  • fully support the test version syntax of Molecule 0.8
  • replaced the parser with Peggy, a successor of peg.js, so the output parser does not require any runtime

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Unit test

@homura homura requested a review from Keith-CY August 6, 2024 01:21
Copy link

vercel bot commented Aug 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
lumos-website ✅ Ready (Inspect) Visit Preview Aug 6, 2024 4:08am

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.05%. Comparing base (66bbbfd) to head (324ca64).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #738      +/-   ##
===========================================
- Coverage    87.89%   87.05%   -0.85%     
===========================================
  Files          133      132       -1     
  Lines        25375    24785     -590     
  Branches      2790     2691      -99     
===========================================
- Hits         22304    21576     -728     
- Misses        3034     3169     +135     
- Partials        37       40       +3     
Files Coverage Δ
packages/molecule/src/codegen.ts 96.33% <100.00%> (-0.39%) ⬇️
packages/molecule/src/nearley.ts 89.04% <100.00%> (-0.51%) ⬇️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66bbbfd...324ca64. Read the comment docs.

@homura
Copy link
Collaborator Author

homura commented Aug 6, 2024

Now developers can paste their .mol with the latest Molecular syntax in the online Molecular parser.

Here is an example from UTXO Stack and its corresponding schema file leap.mol

image

@homura homura changed the title refactor(molecule): support the latest mol grammar feat(molecule): support the latest mol grammar Aug 6, 2024
@homura homura merged commit ae45845 into develop Aug 6, 2024
9 checks passed
@homura homura deleted the molecule-latest-grammar branch August 6, 2024 05:34
@github-actions github-actions bot mentioned this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants